<?php
/**
 * 小邮筒订单
 */
namespace soa\minpost\order\v1\common;

use soa\client;

//用户常用地址
class userAddress  extends client
{
	/**
	 * 服务地址
	 * @var string
	 */
	public $service_url = 'http://mp.kuaidihelp.com/';

	/**
	 * 服务名称
	 * @var string
	 */
	protected $service_name = 'kuaidihelp_mp';

	//添加常用地址
	public function insert($uid,$platform,$addressInfo){
		return $this->post("api/cloudPrint/order/v1/common/userAddress/insert",[
			"uid" => $uid,
			"platform" => $platform,
			"address_info" => $addressInfo,
		]);
	}

	//更新常用地址
	public function update($uid,$platform,$id,$addressInfo){
		return $this->post("api/cloudPrint/order/v1/common/userAddress/update",[
			"uid" => $uid,
			"platform" => $platform,
			"id" => $id,
			"address_info" => $addressInfo,
		]);
	}

	//删除常用地址
	public function del($uid,$platform,$id){
		return $this->post("api/cloudPrint/order/v1/common/userAddress/del",[
			"uid" => $uid,
			"platform" => $platform,
			"id" => $id,
		]);
	}

	//查询常用地址
	public function getByUser($uid,$platform,$limit = [],$orderBy = "id DESC",$extraInfo = []){
		return $this->post("api/cloudPrint/order/v1/common/userAddress/getByUser",[
			"uid" => $uid,
			"platform" => $platform,
			"limit" => $limit,
			"order_by" => $orderBy,
			"extra_info" => $extraInfo,
		]);
	}
}